//
//  ZYXNetManager.h
//  ZYXApp
//
//  Created by 梁炜东 on 2017/4/20.
//  Copyright © 2017年 梁炜东. All rights reserved.
//

#import <Foundation/Foundation.h>
//#define kUserRegistAuth             @"User/Register/"               //注册 发送验证码
#define kUserRegist             @"User/Register/"               //注册
#define kUserLogin              @"User/Login/"           //登录
#define KUserInfoModify             @"User/UpdateInfo/"         //修改个人信息
#define kUserAuthModifPw     @"User/SendPasswordCode/"  //找回密码发送验证验证码
#define kUserForgetPw       @"User/ForgetPassword/" //忘记密码
#define kUserChangePw       @"User/ChangePassword/" //修改密码
#define kUserFeedBack       @"Support/Suggestion/" //意见反馈
#define kUserGetUserInfo    @"User/GerUserInfo/" //获取用户信息

#define kSignVerifyCode         @"index.php/sign/sendregcode"      //注册发送验证码
#define kSignBackpasswd          @"index.php/login/changepassword"       //找回密码
#define OpinionBack              @"index.php/Suggestion/add?cookiekey="         //意见反馈
#define FaultReport              @"index.php/repair/add?cookiekey="         //故障报修
#define modifyPassword              @"index.php/User/changepwd?cookiekey="         //修改密码
#define UploadImage             @"index.php/user/getimagests?cookiekey="         //上传阿里图片请求
#define UploadVideo            @"index.php/user/getvideosts?cookiekey="         //上传阿里视频请求
#define getShareVideo            @"index.php/user/getshareurl?cookiekey="         //获取分享视频的URL
#define kUploadImage            @"Media/Uploadimg/"   //上传图片测试地址

typedef NS_OPTIONS(NSUInteger, RequestType) {
    GET,
    POST,
};

typedef NS_OPTIONS(NSUInteger, RequestSerializer) {
    JSONRequestSerializer,
    HTTPRequestSerializer,
    PropertyListRequestSerializer,
};

typedef NS_OPTIONS(NSUInteger, ResponseSerializer) {
    HTTPResponseSerializer,
    JSONResponseSerializer,
    XMLParserResponseSerializer,
};

typedef NS_OPTIONS(NSUInteger, Content_Type) {
    Form_urlencoded,
    form_data,
    JSON,
    XML,
};

typedef void (^httpResult)(NSURLSessionDataTask *task, id response, NSError *error);
typedef void (^zoProgressBlock)(CGFloat progress);
typedef void (^zoCompleteBlock)(CGFloat complete);

@interface ZYXNetManager : NSObject

/**
 *  获取单例
 *
 *  @return 返回单例对象
 */
+(instancetype)sharedManager;


@property (nonatomic, assign) BOOL isNetWorking;

/**
 *  base url
 */
- (ZYXNetManager* (^)(NSString *baseUrl))bh_baseUrl;

/**
 *  请求url
 */
- (ZYXNetManager* (^)(NSString * url))bh_requestUrl;

/**
 *  请求类型，默认GET
 */
- (ZYXNetManager* (^)(RequestType requestType))bh_requestType;

/**
 *  请求数据类型，默认JSONResponseSerializer
 */
- (ZYXNetManager* (^)(RequestSerializer serializer))bh_requestSerializer;

/**
 *  数据接收类型，默认JSONResponseSerializer
 */
- (ZYXNetManager* (^)(ResponseSerializer serializer))bh_responseSerializer;

/**
 *  请求参数，使用字典NSDictionary *parameters = @{@"foo": @"bar", @"baz": @[@1, @2, @3]};
 */
- (ZYXNetManager* (^)(id parameters))bh_parameters;

/**
 设置整个超时时间
 */
- (ZYXNetManager * (^)(NSTimeInterval timeOut))bh_TimeOut;

/**
 *  配置请求体Content_Type
 */
- (ZYXNetManager* (^)(Content_Type content_Type))bh_ContentType;
/**
 *  上传图片data流
 */
- (ZYXNetManager* (^)(NSData *imageData))bh_ImageData;

/**
 *  开始请求
 *
 *  @param handler 请求完成后的句柄
 */
-(void)startRequestWithCompleteHandler:(httpResult)handler;

/**
 *  图片的上传
 *
 *  @param handler 请求完成后的句柄
 */
-(void)startImageUploadWithCompleteHandler:(httpResult)handler;


///**
// 固件升级特殊参数方式 开始请求
// */
//-(void)startRequestUpdateWithCompleteHandler:(httpResult)handler;


@end
